package com.example.lin.start;

import com.example.lin.dto.BaseDTO;
import com.example.lin.util.ExportUtil;
import com.example.lin.util.ImportUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @className: MainFile
 * @description: 文件生成处理类
 * @author: Lin.Gu
 * @date: 2024/2/6
 */
public class MainFile {

    public static void main(String[] args) {
        String filePath = "C:\\Users\\181596\\Desktop\\账期用户1.xlsx";
        List<Object[]> dataList = new ArrayList<>();
        dataList.add(new Object[]{"客户ID", "客户名称", "客户类型", "账期", "备注"});

        //获取需要组装的数据
        Map<String, Object> map = ImportUtil.readExcelMap(BaseDTO.builder().filePath(filePath).sheet(1).build());

        //开始组装
        List<Object[]> objects = ImportUtil.readExcelList(BaseDTO.builder().filePath(filePath).
                dataList(dataList).oneMap(map).oneMapIndex(4).oneKeyIndex(0).build());
        //System.out.println(JSON.toJSON(objects));

        //输出文件
        ExportUtil.exportTheFile("test", objects);
    }
}
